package com.qf.j2102.service.impl;

import com.qf.j2102.mapper.SysAdminMapper;
import com.qf.j2102.po.SysAdmin;
import com.qf.j2102.po.SysCar;
import com.qf.j2102.po.SysOrder;
import com.qf.j2102.po.SysUser;
import com.qf.j2102.service.SysAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("sysAdminService")
public class SysAdminServiceImpl implements SysAdminService {

    @Autowired
    private SysAdminMapper sysAdminMapper;

    @Override
    public SysAdmin login(String a_uname, String a_pword) {
        SysAdmin sysAdmin = sysAdminMapper.selectOne(a_uname, a_pword);
        //System.out.println(sysAdmin);
        return sysAdmin;
    }

    @Override
    public int regist(SysAdmin sysAdmin) {
        int i = sysAdminMapper.insertOne(sysAdmin);
        return i;
    }

    @Override
    public List<SysUser> selectAllUsers() {
        List<SysUser> sysUsers = sysAdminMapper.selectAllUsers();
        return sysUsers;
    }

    @Override
    public List<SysCar> selectAllCars() {
        List<SysCar> sysCars = sysAdminMapper.selectAllCars();
        return sysCars;
    }

    @Override
    public List<SysOrder> selectAllOrders() {
        List<SysOrder> sysOrders = sysAdminMapper.selectAllOrders();
        return sysOrders;
    }

    @Override
    public int delUser(List<Integer> a_ids) {
        int i = sysAdminMapper.delUser(a_ids);
        return i;
    }

    @Override
    public int delCar(List<Integer> c_ids) {
        int i = sysAdminMapper.delCar(c_ids);
        return i;
    }

    @Override
    public int delOrder(List<Integer> o_ids) {
        int i = sysAdminMapper.delOrder(o_ids);
        return i;
    }

    /**
     * 修改个人信息
     * @param sysAdmin
     * @return
     */
    @Override
    public int update(SysAdmin sysAdmin) {
        return sysAdminMapper.update(sysAdmin);
    }
}
